<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>移动端下载</title>
    <script type="text/javascript" src="lib/jquery-1.12.4.min.js"></script>
<!--    <script src="https://unpkg.com/callapp-lib"></script>-->
    <script src="./lib/callapp-lib.js"></script>
</head>
<body>
<div id="message" style="display: none;">
    <span>点击右上角按钮，然后在弹窗的菜单中，点击在浏览器中打开</span>
</div>
<script>
    var androidApp = "https://www.pgyer.com/52AI"
    var iosApp = "https://apps.apple.com/cn/app/%E6%99%8B%E5%B7%9E%E5%9C%B0%E8%B4%A8%E4%BB%B6/id1665502079"
    if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
        const options = {
            timeout: 1000,
            scheme: {protocol: 'matchu'},
            appstore: iosApp
        }
        const callLib = new CallApp(options)
        callLib.open({
            path: '',
            callback: ()=>{
                if(navigator.appVersion.match(/micromessenger\/(\d+\.\d+\.\d+)/i)){
                    $("#message").show()
                } else {
                    location.href=iosApp
                }
            }
        })
    } else if (/(Android)/i.test(navigator.userAgent)) {
        location.href=androidApp
    }

</script>
</body>
</html>
